package com.mall.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.mall.db.domain.Brief;
import com.mall.db.service.BriefService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/system/bcc")
public class BriefController extends BaseController<Brief>{
    @Resource(name = "briefService")
    private BriefService bs;
    @Override
    public Map<String, Object> find(Brief brief) {
        QueryWrapper qw=new QueryWrapper();
       List<Brief>list= bs.list(qw);
        Map<String,Object> map=new HashMap<>();
        map.put("code",0);
        map.put("data",list);
        return map;
    }

    @Override
    public Map<String, Object> add(Brief brief) {
        boolean b=bs.save(brief);
        return this.iud("添加",b,brief);
    }

    @Override
    public Map<String, Object> delete(Brief brief) {
        boolean b=bs.removeById(brief.getId());
        return this.iud("删除",b,brief);
    }
}
